package com.wn.cloud.stream.receive;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * @FileName: MessageReceiveService
 * @Description: TODO
 * @Author: MaWenHao
 * @Created: 2020/3/28 - 20:54
 * @Version: V1.0
 * @Company: 东方微银科技（北京）有限公司
 */
@Slf4j
@Component
@EnableBinding(Sink.class)
public class MessageReceiveService {

    @Value("${server.port}")
    private String serverPort;

    @StreamListener(Sink.INPUT)
    public void receive(Message<String> message) {
        log.info(serverPort + ":  " + message.getPayload());
    }
}
